#include "Sort.h"
#include <iostream>
using namespace std;

int main() {
    int arr[10] = {-1, 20, 4, 6, 0, 75, -2, -11, -3, 1};
    int length = 10;

    if (!(isSorted(arr, length))) {
        sort(arr, length);
    };
    print(arr, length);
};

void sort(int* array, int size) {
    for (int i = size - 1; i >= 0; i--) {
        for (int j = 0; j < i; j++) {
            if (array[j] > array[j + 1]) {
                int t = array[j];
                array[j] = array[j + 1];
                array[j + 1] = t;
            }
        }
    }
};

bool isSorted(int* array, int size) {
    for (int i = 0; i < size - 1; i++) {
        if (array[i] > array[i + 1]) return false;
    };
    return true;
};

void print(int* array, int size) {
    for (int i = 0; i < size - 1; i++) {
        cout << array[i] << "  ";
    }
    cout  << "\n";
}
